﻿using System;

namespace WebComicPage
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void BtnLoginClick(object sender, EventArgs e)
        {
            string user = txbUserName.Text;
            string password = txbPassword.Text;
            lblError.Visible = false;

            ComicWebServices.ComicWebServicesSoapClient cwb = new ComicWebServices.ComicWebServicesSoapClient();
            try
            {
                bool ans = cwb.Login(user, password);
                if (ans)
                {
                    Response.Redirect("Search.aspx");
                }
                else
                {
                    lblError.Text = "Username or Password are Invalid";
                    lblError.Visible = true;
                }
            }
            catch (Exception)
            {

                lblError.Text = "Webservice is down";
                lblError.Visible = true;
            }


        }


    }
}